<?php

/**
 * Ejemplares form base class.
 *
 * @method Ejemplares getObject() Returns the current form's model object
 *
 * @package    sbweb3
 * @subpackage form
 * @author     Pablo Andrés Díaz
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseEjemplaresForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'idejemplar' => new sfWidgetFormInputText(),
      'no_adqui'   => new sfWidgetFormInputHidden(),
      'biblioteca' => new sfWidgetFormInputHidden(),
      'ficha'      => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Fichas'), 'add_empty' => true)),
      'anio'       => new sfWidgetFormInputText(),
      'volumen'    => new sfWidgetFormInputText(),
      'numero'     => new sfWidgetFormInputText(),
      'ejemplar'   => new sfWidgetFormInputText(),
      'created_at' => new sfWidgetFormDateTime(),
      'updated_at' => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'idejemplar' => new sfValidatorInteger(array('required' => false)),
      'no_adqui'   => new sfValidatorChoice(array('choices' => array($this->getObject()->get('no_adqui')), 'empty_value' => $this->getObject()->get('no_adqui'), 'required' => false)),
      'biblioteca' => new sfValidatorChoice(array('choices' => array($this->getObject()->get('biblioteca')), 'empty_value' => $this->getObject()->get('biblioteca'), 'required' => false)),
      'ficha'      => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Fichas'), 'required' => false)),
      'anio'       => new sfValidatorInteger(array('required' => false)),
      'volumen'    => new sfValidatorInteger(array('required' => false)),
      'numero'     => new sfValidatorInteger(array('required' => false)),
      'ejemplar'   => new sfValidatorInteger(array('required' => false)),
      'created_at' => new sfValidatorDateTime(),
      'updated_at' => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('ejemplares[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Ejemplares';
  }

}
